package com.deryun.tyl.dao.impl;

import java.util.List;

import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;

import com.deryun.tyl.bean.ContentMessage;
import com.deryun.tyl.bean.User;
import com.deryun.tyl.bean.mapper.UserMapper;


public class UserDaoImpl extends SqlSessionDaoSupport{

	@Autowired
	private UserMapper userMapper;
	

	public User getUserByUsername(String username) {
		return userMapper.getUserByUsername(username);
	}


	public User doLogin(String username, String password) {
		return userMapper.doLogin(username, password);
	}
	
	public int addUser(User user){
		return userMapper.addUser(user);
	}
	
	public User validateUser(User user){
		System.out.println(user.getUsername()+user.getInstitutionName());
		return userMapper.validateUser(user.getUsername(),user.getInstitutionName());
	
	}
	
	public int getNewId(){
		return userMapper.getNewId();
	}
	
	public int authInstitution(User tuser){
		return userMapper.authInstitution(tuser);
	}
	
	public int authOneKey(String id){
		return userMapper.authOneKey(id);
	}
	public int authBank(String id){
		return userMapper.authBank(id);
	}
	
	public List<User> getAllUser(){
		return userMapper.getAllUser();
	}
	public User getUserById(int id){
		return userMapper.getUserById(id);
	}
	public List<User> searchUser(String role,String institutionName){
		return userMapper.searchUser(role, institutionName);
	}
	
	public int modifyUser(User user){
		return userMapper.modifyUser(user);
	}
	
	public int accessAuth(User user){
		return userMapper.accessAuth(user);
	}
	
	public List<User> searchAuth(String auth,String institutionName){
		return userMapper.searchAuth(auth, institutionName);
	}
	
	public int toFrontSupplier(int id){
		return userMapper.toFrontSupplier(id);
	}
	
	public int toOneKeySupplier(int id){
		return userMapper.toOneKeySupplier(id);
	}
	
	public int removeFrontSupplier(int id){
		return userMapper.removeFrontSupplier(id);
	}
	
	public int removeOneKeySupplier(int id){
		return userMapper.removeOneKeySupplier(id);
	}
	
	public int getCountFront(){
		return userMapper.getCountFront();
	}
	
	public int getCountOneKey(){
		return userMapper.getCountOneKey();
	}
	
	public List<User> getFrontSupplier(){
		return userMapper.getFrontSupplier();
	}
	
	public List<User> getOneKeySupplier(){
		return userMapper.getOneKeySupplier();
	}
}
